<form action="{:U('Index/updataTag')}" method="post" id="myform">
<div class="modal-body row" id="myModal">
<foreach name="tag" item="tagTitle">
    <div class="col-xs-3">
        <select multiple="multiple" title="{$tagTitle['tag_content']}" class="select" name="tag">
        <foreach name="tagTitle['cate']" item="tagCont">
          <if condition="$tagCont['pass'] eq 1">
            <option value="{$tagCont['tag_id']}" selected="selected">{$tagCont['tag_content']}</option>
            <else/>
            <option value="{$tagCont['tag_id']}" >{$tagCont['tag_content']}</option>
            </if>
         </foreach>
        </select>
    </div>
    </foreach>
</div>
<div class="modal-footer">
    <input type="hidden" value="{$type}" name="type" id="hid" />
    <button type="submit" class="btn btn-success queren" id="invite-sub" data-dismiss="modal">确认</button>
</div>
</form>
<script src="__PUBLIC__/js/bootstrap-select.js"></script>
<script type="text/javascript">
	$(document).ready(function () {
		$("select").selectpicker({ style: 'btn-block btn-primary', menuStyle: 'dropdown-inverse' });
			
		$('.queren').click(function(){
			var data = $('#myform').serializeArray();
			$('#fav').html('');
			for( var tag in data)
			{
				if(data[tag].name == 'tag'){
					var color = Math.round(Math.random()*10)%6;
					if(color==0){color=color+1;}
					$('#fav').append('<span><span value=' + data[tag].value + ' class="btn tag tag-'+color+'">'+$('#myform').find('option[value='+data[tag].value+']').html()+'</span></span> ');
				}
			}
			$('#custom .leftCont,#custom .rightCont').html('');
			$('#custom .fildLoad').attr('value',0);
			$('.fildLoad').each(function(index, element) {
				if($(this).is(':visible'))
						$(this).click(); 
			});
			
		});
	
	});
</script>

